package com.ybkj.o2o.mc.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.ybkj.o2o.mc.common.query.DepartmentQuery;
import com.ybkj.o2o.mc.entity.Department;


public interface DepartmentMapper {

	/**
	 * 根据名称和系统key查询信息.
	 *
	 * @param name   名称
	 * @param appKey 系统key
	 * @param enterpriseId 
	 * @return 企业信息
	 */
	Department findByNameAndAppkey(@Param("name") String name, @Param("appKey") String appKey,@Param("enterpriseId") Long enterpriseId);

	/**
	 * 新增部门
	 * 
	 * @param department
	 * @return
	 */
	int insert(Department department);

	/**
	 * 根据参数查询部门
	 * 
	 * @param departmentQuery
	 * @return
	 */
	List<Department> selectByDepartmentQuery(DepartmentQuery departmentQuery);

	/**
	 * 根据参数查询部门的数量
	 * 
	 * @param departmentQuery
	 * @return
	 */
	Long countByDepartmentQuery(DepartmentQuery departmentQuery);

	/**
	 * 通过id和appKey查询部门
	 * 
	 * @param id
	 * @param appKey
	 * @return
	 */
	Department findByIdAndAppkey(@Param("id") Long id, @Param("appKey")String appKey);
	
	/**
	 * 通过id修改部门信息
	 * 
	 * @param department
	 * @return
	 */
	int updateByPrimaryKey(Department department);
	
	/**
	 * 通过id删除部门
	 * 
	 * @param id
	 * @param appKey
	 * @return
	 */
	int deleteByPrimaryKey(@Param("id") Long id, @Param("appKey")String appKey);

	int updateBalance(Department department);

	/**
	 * 通过id批量删除部门
	 * 
	 * @param departmentIds
	 * @param appKey
	 * @return
	 */
	int batchDeleteByIds(@Param("departmentIds") List<Long> departmentIds, @Param("appKey") String appKey);

	int updateEnterpriseNameByEnterpriseId(@Param("enterpriseId")Long enterpriseId,
			@Param("enterpriseName")String enterpriseName, @Param("appKey")String appKey);

	int updateCompanyName(@Param("companyId")Long companyId, @Param("abbreviation")String abbreviation, @Param("appKey")String appKey);
}
